package locating;

public enum Direction {
	SOUTH(0),
	SOUTHWEST(1),
	WEST(2),
	NORTHWEST(3),
	NORTH(4),
	NORTHEAST(5),
	EAST(6),
	SOUTHEAST(7);

	private int orientation;

	Direction(int orientation) {
		this.orientation = orientation;
	}

	public int getOrientation() {
		return orientation;
	}

	public static Direction getFacingDirection(int orientation) {
		int i = orientation / 2048;

		for (Direction direction : Direction.values()) {
			if (direction.getOrientation() == i) {
				return direction;
			}
		}

		return null;
	}
}
